/*
 * @Description: 回收站相关接口
 * @Author: Rfan
 * @Date: 2022-10-31 17:56:05
 * @LastEditTime: 2022-10-31 17:56:05
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRecycleListParams {
  archiveTypeId?: number;
  createTime?: string;
  dbName?: string;
  fondsId?: number;
  id?: number;
  level?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  remark?: string;
  title?: string;
}

// 分页获取回收站列表
export function fetchRecycleListByPage(data: IPageQuery<IRecycleListParams>) {
  return request({
    url: `/recycle-bin/page`,
    method: 'post',
    data
  });
}

// 删除回收站条目
export function deleteRecycleItem(id: Key) {
  return request({
    url: `/recycle-bin/${id}`,
    method: 'delete'
  });
}

// 一键清空
export function clearAllItem() {
  return request({
    url: `/recycle-bin/to-empty`,
    method: 'delete'
  });
}

// 恢复
export function restoreItem(data: number[]) {
  return request({
    url: `/recycle-bin/restore`,
    method: 'post',
    data
  });
}
